package com.ac.app.web.action.pick;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.caac.core.web.action.BaseAction;
import com.caac.core.web.form.BaseForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright AgileCentury 2008</p>
 * <p>Company: AgileCentury </p>
 * @author <a href="mailto:ac@agilecentury.com">Agile</a>
 * @version 1.0
 */

public class ActivePkRecordAction extends BaseAction {

    protected ActionForward doExecute(ActionMapping mapping,
                                      BaseForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response)
            throws Exception {
    	String id = request.getParameter("id");
        String state = request.getParameter("state");
        
        JdbcTemplate manager = (JdbcTemplate) this.getBean("jdbcTemplate");
        String url = (String) (((Map)manager.queryForList("select url from pick_record where id='"+id+"'").get(0)).get("URL"));
        manager.execute("UPDATE PICK_URL SET URL_KIND='" + state + "' WHERE URL='" + url + "'");
        return forward(mapping);
    }
}
